<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>

<script type="text/javascript">
	function checkForm(){
		var item = $('#item').value;
		var description = $('#description').value;
		var buildId = $('#buildId').value;
		var roomId = $('#roomId').value;
		var reason = $('#reason').value;
		var date = $('#date').value;
		if(item==""||description==""||buildId==""||roomId==""||reason==""||date==""){
			document.getElementById("error").innerHTML="信息填写不完整！";
			return false;
		}
		return true;
	}

	$(document).ready(function(){
		$("ul li:eq(3)").addClass("active");
		$('.form_date').datetimepicker({
			language:  'zh-cn',
			weekStart: 1,
			todayBtn:  1,
			autoclose: 1,
			todayHighlight: 1,
			startView: 2,
			minView: 2,
			forceParse: 0
		});
	});

</script>
<div class="data_list">
	<div class="data_list_title">
		添加维修申请
	</div>
	<form action="repair?action=save" method="post" onsubmit="return checkForm()">
		<div class="data_form" >
			<input type="hidden" id="buildId" name="buildId" value="${currentUser.buildId }"/>
			<input type="hidden" id="roomId" name="roomId" value="${currentUser.roomId }"/>
			<table align="center">
				<tr>
					<td><font color="red">*</font>维修项目：</td>
					<td><input type="text" id="item"  name="item"  style="margin-top:5px;height:30px;"/></td>
				</tr>
				<tr>
					<td><font color="red">*</font>描述：</td>
					<td><input type="text" id="description"  name="description" style="margin-top:5px;height:30px;"/></td>
				</tr>
				<tr>
					<td><font color="red">*</font>学生ID：</td>
					<td><input type="text" id="userId"  name="userId" value="${currentUser.id}"  style="margin-top:5px;height:30px;" readonly/></td>
				</tr>
				<tr>
					<td><font color="red">*</font>学生姓名：</td>
					<td><input type="text" id="userName"  name="userName" value="${currentUser.userName}"  style="margin-top:5px;height:30px;" readonly/></td>
				</tr>
				<tr>
					<td><font color="red">*</font>楼栋号：</td>
					<td><input type="text" id="buildName"  name="buildName" value="${currentUser.buildName}"  style="margin-top:5px;height:30px;" readonly/></td>
				</tr>
				<tr>
					<td><font color="red">*</font>宿舍号：</td>
					<td><input type="text" id="roomNum"  name="roomNum" value="${currentUser.roomNum}"  style="margin-top:5px;height:30px;" readonly/></td>
				</tr>
				<tr>
					<td><font color="red">*</font>日期：</td>
					<td>
						<span class="controls input-append date form_date" style="margin-right: 10px" data-date="" data-date-format="yyyy-mm-dd" data-link-format="yyyy-mm-dd">
							<input id="date" name="date" style="width:150px;height: 30px;" placeholder="维修日期" type="text" >
							<span class="add-on"><i class="icon-remove"></i></span>
							<span class="add-on"><i class="icon-th"></i></span>
               			</span>
					</td>
				</tr>
				<tr>
					<td><font color="red">*</font>维修人：</td>
					<td><input type="text" id="repairor"  name="repairor"  style="margin-top:5px;height:30px;" /></td>
				</tr>
				<tr>
					<td><font color="red">*</font>维修状态：</td>
					<td><input type="text" id="status"  name="status" value="等待维修" style="margin-top:5px;height:30px;" readonly/></td>
				</tr>
			</table>
			<div align="center">
				<input type="submit" class="btn btn-primary" value="保存"/>
				&nbsp;<button class="btn btn-primary" type="button" onclick="javascript:window.location='repair'">返回</button>
			</div>
			<div align="center">
				<font id="error" color="red">${error }</font>
			</div>
		</div>
	</form>
</div>